﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Be.Windows.Forms;

namespace Pahan.McuFusion.UI.Controls
{
    public partial class DualPanelHexBox
    {
        [TypeConverter(typeof(ExpandableObjectConverter))]
        public class PanelOptions
        {
            #region Contructors

            internal PanelOptions(Panel panel, Label lbCaption, HexBox hexBox)
            {
                this.panel = panel;
                this.lbCaption = lbCaption;
                this.hexBox = hexBox;
            }

            #endregion

            #region Private Fields

            private Label lbCaption;

            private HexBox hexBox;

            private Panel panel;

            #endregion

            #region Public Properties

            [DefaultValue("")]
            public String Caption
            {
                get
                {
                    return lbCaption.Text;
                }
                set
                {
                    lbCaption.Text = value;
                }
            }

            [DefaultValue(BytesPerLine.Auto)]
            public BytesPerLine BytesPerLine
            {
                get
                {
                    if (!hexBox.UseFixedBytesPerLine)
                    {
                        return BytesPerLine.Auto;
                    }

                    return (BytesPerLine)hexBox.BytesPerLine;
                }
                set
                {
                    if (value == BytesPerLine.Auto)
                    {
                        hexBox.UseFixedBytesPerLine = true;
                    }
                    else
                    {
                        hexBox.UseFixedBytesPerLine = false;
                        hexBox.BytesPerLine = (int)value;
                    }
                }
            }

            [DefaultValue(HexCasing.Upper)]
            public HexCasing HexCasing
            {
                get
                {
                    return hexBox.HexCasing;
                }
                set
                {
                    hexBox.HexCasing = value;
                }
            }

            [DefaultValue(true)]
            public bool LineInfoVisible
            {
                get
                {
                    return hexBox.LineInfoVisible;
                }
                set
                {
                    hexBox.LineInfoVisible = value;
                }
            }

            [DefaultValue(false)]
            public bool StringViewVisible
            {
                get
                {
                    return hexBox.StringViewVisible;
                }
                set
                {
                    hexBox.StringViewVisible = value;
                }
            }

            [DefaultValue(null)]
            public IByteProvider ByteProvider
            {
                get
                {
                    return hexBox.ByteProvider;
                }
                set
                {
                    hexBox.ByteProvider = value;
                }
            }

            [DefaultValue(true)]
            public bool Enabled
            {
                get
                {
                    return panel.Enabled;
                }
                set
                {
                    panel.Enabled = value;
                }
            }

            #endregion
        }
    }
}